﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Assets.Scripts
{
    abstract class TaskBase<T> : ITask
    {
        /// <summary>
        /// 任务名称
        /// </summary>
        public virtual string TaskName
        {
            get
            {
                return "BaseTask";
            }
        }
        /// <summary>
        /// 文件路径
        /// </summary>
        public string FilePath;
        /// <summary>
        /// 任务ID
        /// </summary>
        public abstract int TaskID { get; set; }
        /// <summary>
        /// 任务状态
        /// </summary>
        public abstract TaskStatus taskStatus { get; set; }
        /// <summary>
        /// 任务耗时
        /// </summary>
        public abstract TimeSpan Eslapsed { get; set; }
        /// <summary>
        /// 任务可回滚
        /// </summary>
        public virtual bool IsCanReverse { get; }
        /// <summary>
        /// 回滚
        /// </summary>
        public virtual void OnReverse() { }
        /// <summary>
        /// 任务准备
        /// </summary>
        public abstract void OnReady();
        /// <summary>
        /// 任务执行
        /// </summary>
        /// <param name="cancellationToken"></param>
        public abstract void OnDoTask(CancellationToken cancellationToken);
        /// <summary>
        /// 任务结束
        /// </summary>
        public abstract void OnFinal();
        /// <summary>
        /// 任务状态改变
        /// </summary>
        /// <param name="taskStatus"></param>
        public abstract void OnStatueChanged(TaskStatus taskStatus);
    }
}
